# -*- coding: utf-8 -*-

from odoo.http import request

from odoo_contrib.meta import Singleton


class Settings(object, metaclass=Singleton):
    def __init__(self):
        self.page_size = int(request.env['ir.config_parameter'].sudo().get_param('exhibition.page_size'))
        self.attachment_url_prefix = \
            request.env['ir.config_parameter'].sudo().get_param('exhibition.attachment_url_prefix')
        self.exhibit_page_path = request.env['ir.config_parameter'].sudo().get_param('exhibition.exhibit_page_path')
        self.label_card_width = int(request.env['ir.config_parameter'].sudo().get_param('exhibition.label_card_width'))
        self.video_on = bool(request.env['ir.config_parameter'].sudo().get_param('exhibition.video_on'))
        self.video_url_prefix = request.env['ir.config_parameter'].sudo().get_param('exhibition.video_url_prefix')

    @classmethod
    def dereference(cls):
        cls._instances.pop(cls, None)
